package com.zxd.array;

import java.util.Arrays;
import java.util.function.IntToDoubleFunction;
import java.util.function.IntUnaryOperator;

/**
 * ClassName:newarrays
 * Package:com.zxd
 *
 * @Date:2023/9/19 18:58
 * @Author:zxde
 */
public class MyArrays {
    public static void main(String[] args) {
        int[] arr1 = {1,2,3,4,5};
        //Arrays的静态方法toString可以将一个数组转化为String
        // public static String toString(T[] arr)
        String arr1String = Arrays.toString(arr1);

        //public static T[] copyOfRange(T[],start,end)
        //copyOfRange方法，将arr1从索引0复制到3 [0,3)
        int[] arr2 = Arrays.copyOfRange(arr1, 0, 3);

        //public static T[] copyOf(T[] arr,int length )
        int[] arr3 = Arrays.copyOf(arr1, 10);//将原数组扩充到10，剩下的位置用0填充

        Arrays.setAll(arr1, operand -> arr1[operand]+1);

        System.out.println("xxx");
    }
}
